import request from "../utils/request.js";

// 平台简介
const shopintro = '/api/shops/intro';
// 用户协议
const useragreement = '/api/shops/user-agreement'
// 隐私政策
const privacypolicy = '/api/shops/privacy-policy';
// logo
const logourl = '/api/shops/logo';
// 首页

// 轮播图
const carouselsUrl = '/api/shops/carousels';
// tab栏
const navigationsUrl = '/api/shops/navigations'
// 秒杀
const seckilllistUrl= '/api/seckill/goods/list'
// 秒杀商品详情
const skillDetail = '/api/seckill/goods/details/'
// 秒杀商品提交
const subSkill = '/api/seckill/order/save'
// 推荐商品
const productlistUrl = '/api/goods/list';
//时光方面
const timePic = '/api/shops/time/image'
//时光内容
const timeCt ='/api/shops/time/content'
const productlistUrl2 = '/api/goods/recommend';
// 视频展示
const videoUrl = '/api/shops/video';
// 公司介绍
const aboutUrl = '/api/shops/about';
// 首页分类商品推荐接口饮用水区
const waterGoods = '/api/shops/home-cate-goods'
// 上传图片
const uploadTp ='https://vw.xcyouguo.com/public/images/upload'
// 商品上下价
const setGoods ='/api/store/goods/status'


//上传图片
export function upImage(data){
	return new Promise((resolve, reject)=>{
		uni.request({
			url:uploadTp,
			data,
			method:"POST",
			header:{'content-type':'application/x-www-form-urlencoded'}
		}).then(res=>{
			if(res.data.code==200){
				resolve(res.data)
			}else{
				reject(res.data.msg)
			}
		})
	})
	
}

// logo
export function getlogo(data) {
  return request({
    url: logourl,
    method: 'get',
    data
  })
}
// 平台简介
export function getshopintro(data) {
  return request({
    url: shopintro,
    method: 'get',
    data
  })
}

// 用户协议
export function getuseragreement(data) {
  return request({
    url: useragreement,
    method: 'get',
    data
  })
}
// 隐私政策
export function getprivacypolicy(data) {
  return request({
    url: privacypolicy,
    method: 'get',
    data
  })
}
// 轮播图
export function getCarousels(data) {
  return request({
    url: carouselsUrl,
    method: 'get',
    data
  })
}


// tab栏
export function getTabList(data) {
  return request({
    url: navigationsUrl,
    method: 'get',
    data
  })
}
//时光封面
export function getTimePic(data) {
  return request({
    url: timePic,
    method: 'get',
    data
  })
}
//时光内容
export function getTimePicCt(data) {
  return request({
    url: timeCt,
    method: 'get',
    data
  })
}
// 秒杀
export function getSeckill(data) {
  return request({
    url: seckilllistUrl,
    method: 'get',
    data
  })
}
// 首页分类商品推荐接口饮用水区
export function getWaterGoods(data) {
  return request({
    url: waterGoods,
    method: 'get',
    data
  })
}
// 推荐商品
export function getGoodList(data) {
  return request({
    url: productlistUrl,
    method: 'get',
    data
  })
}
export function getGoodListno2(data) {
  return request({
    url: productlistUrl2,
    method: 'get',
    data
  })
}
// 视频展示
export function getvideoUrl(data) {
  return request({
    url: videoUrl,
    method: 'get',
    data
  })
}
// 公司介绍
export function getaboutUrl(data) {
  return request({
    url: aboutUrl,
    method: 'get',
    data
  })
}
// 商品列表
export function getGoodslist(data) {
  return request({
    url: '/api/goods/list',
    method: 'get',
    data
  })
}

export function getTzList(data){
	return request({
		url:'/api/shops/announcements',
		method:'get',
		data
	})
}

export function getTzListInfo(data){
	return request({
		url:'/api/shops/announcements/info',
		method:'get',
		data
	})
}
export function getskillDetail(data){
	return request({
		url:skillDetail+data,
		method:'get',
		// data
	})
}
export function submitSkill(data){
	return request({
		url:subSkill,
		method:'post',
		data
	})
}
export function uDgoods(data){
	return request({
		url:setGoods,
		method:'post',
		data
	})
}


